import request from '~/utils/request'
import type { ModuleList, Module, ScreenType } from './types'

class APICommon {
    /** 获取新模块列表 */
    static getNewModuleList(category_type: any) {
        return request<any>('/getNewModuleList', {
            method: 'POST',
            body: { category_type }
        })
    }

    static getModule(data: any, params?: PageQuery) {
        return request<Module[]>('/getModule', {
            method: 'POST',
            body: data,
            params
        })
    }

    /** 获取二十四节气 */
    static getPeriodsList() {
        return request<any>('/getPeriodsList', {
            method: 'POST'
        })
    }

    /** 获取筛选调教类目 */
    static getScreen(type: ScreenType) {
        return request<any>('/getScreen', {
            method: 'POST',
            body: { type }
        })
    }

    /** 点击详情 -已读 */
    static readNotify(id: any) {
        return request<any>('/readNotify', {
            method: 'POST',
            body: { id }
        })
    }

    /** 获取合作伙伴 */
    static getParentList(data: any, params?: PageQuery) {
        return request<Module[]>('/getParentList', {
            method: 'POST',
            body: data,
            params
        })
    }

    static getWebIcon() {
        return request<any>('/getWebIcon', {
            method: 'POST',
        })
    }

    /** 获取活动列表 */
    static getActivityList(data: any, params?: any) {
        return request<any>('/getActivityList', {
            method: 'POST',
            body: data,
            params
        })
    }

    /** 获取店铺信息 */
    static getSquareShopGoods(shop_id: any) {
        return request<any>('/getSquareShopGoods', {
            method: 'POST',
            body: { shop_id }
        })
    }

    static setActivityForward(id: any) {
        return request<any>('/setActivityForward', {
            method: 'POST',
            body: { id }
        })
    }

    static getActivityDeail(id: any) {
        return request<any>('/getActivityDeail', {
            method: 'POST',
            body: { id }
        })
    }

}

export default APICommon
